Anchored objects always sit on top of text frames. There is no way around it. Sorry!
should the graphic line be positioned behind the text or behind the frame (that is perhaps filled with an opaque color)?
There are three different ways to anchor objects to text.
"Above Line" will create a type of anchored object where all the text that comes after the anchor character is above the anchored object.
So you could "stack" the anchored object between the fill of the text frame and the text itself.
Anchor the graphic line in its own paragraph.
Control the vertical position by using the distance controls for above and below in the anchored object settings.
You could set the values to positive and negative numbers.
For positioning horizontal you could use the right/left/center align positioning controls.
You could fine tune the horizontal position by using paragraph insets for all lines or for the first line of the paragraph the anchor character is living in.
For negative values in horizontal position you could use a helper object you could group with the graphic line that would expand the whole anchored object when aligned center or right.
Here an example from my German InDesign:
If in doubt, post a screen shot of the text frame and the graphic line with the right position not anchored.
Show hidden text and show frame edges should be on.
Hope that helps.
Some ideas to fake it:
We could use a group of three or four objects and anchor them "Above Line". The left helper and the center helper objects will not have a fill color.
We could use a helper rectangle grouped to a compound path and anchor the group "Above Line".
We could use two different anchored objects and anchor them to the left and to the right of the text frame.
What contents should go into the yellow frame?
What is its purpose?
Will the pink text frame be filled with an opaque color?
Will the yellow text frame be filled with an opaque color?
If yes, all ideas above could work.
The idea was to have as few of items as possible since the document will be processed for Accessibility and the more small items added the more you have to take out or re-tag. The pink frame would always have text and have a gradient fill (adding complication I know;) ) and the yellow would have no text, just color. I think the most practical solution I have found to balance the prep work with the post-Accessibility tagging in these documents is to use some tables. Though I appreciate the immediate responses and the ideas. Thank you.