Btw. I'm glad you get somehow involved in this stuff :-)
Yes, inside CR2 file, actual orientation of embedded JPG file and actual orientation of raw image data is always the same: horizontal (no matter how camera was held).
When DPP opens raw, it reads Exif:Orientation value, rotates raw image data if needed, and displays image horizotally (no rotation was applied) or vertically. Thus, if you see vertical (CR2!) image inside DPP, you must know, it was rotated on-the-fly (just for you).
When you convert to JPG/TIFF, then DPP always rotates image to needed orientation, and set Exif:Orintation tag inside resulting JPG to Horizontal -meaning: software, which opens this image (some image viewer), doesn't need to do any rotation before displaying.
Now, if I understand your idea, I could embedd JPG into CR2, as it is, and only change Exif:Orientation tag (inside CR2) according to new embedded image orientation?
This doesn't work, I've tried (see above: When DPP opens raw) -DPP shows vertical images horizontally.
In short: embedded JPG must have horizontal orientation (having width greater than height), and Exif:Orientation value (inside CR2) shouldn't be changed. So, before embedding, JPG must be rotated (if needed). It's only, from where this info (in which direction to rotate) can be obtained -and I believe, the simplest way is to read Orientation from source (CR2) file, and do reverse rotation.
Yes, JPG's comming from DPP, do always have Orientation value Horizontal -this just tells the software (DPP, ACDSee,...) image shouldn't be rotated (because it allready has proper orientation) when displayed.
Yes, 99% of all software reads Orientation tag value before displaying image. Well, Windows Fax and Image viewer isn't among them, but still displays vertical JPG images (from DPP) correctly -because (as said), DPP has already done proper rotation.
I hope, I helped you clarify some things... and, at the same time, all above helps me, not to forget something :-)
PS: Sorry, if I've repeated me too much... as engilsh isn't my native language, and I want to be sure, I made myself clear.